<template>
  <card ref="Card">
    <div slot="header">
      <el-input placeholder="订单号" v-model="searchNumber" style="width: 160px" clearable @keyup.enter.native="getData"/>
      <el-button type="success" @click="getData" class="ml-10">搜索</el-button>
    </div>
    <el-table :data="formData">
      <el-table-column prop="number" label="订单号" width='140'/>
      <el-table-column prop="reason" label="修改原因"/>
      <el-table-column prop="weight" label="重量"/>
      <el-table-column prop="freight" label="运费"/>
      <el-table-column prop="articleName" label="内件品名"/>
      <el-table-column prop="laosArticleName" label="内件品名"/>
      <el-table-column prop="receiverName" label="收件人姓名"/>
      <el-table-column prop="laosReceiverName" label="收件人姓名"/>
      <el-table-column prop="receiverAddress" label="收件人详细地址"/>
      <el-table-column prop="laosReceiverAddress" label="收件人详细地址"/>
      <el-table-column prop="receiverPhone" label="收件人联系电话"/>
      <el-table-column prop="sendToUserName" label="发往网点"/>
      <el-table-column prop="printTime" label="打印时间">
        <template slot-scope="scope">
          <span>{{scope.row.printTime | formatDateTime}}</span>
        </template>
      </el-table-column>
    </el-table>
    <pagination ref="Pagination" @update="getData"/>
  </card>
</template>

<script>
  import {pageCurrentEditExpressOrderApi} from '@/api/order/edit'

  export default {
    name: 'HadPass',
    data() {
      return {
        formData: [],
        searchNumber: '',
        state: 1 // 0未处理 1已同意 2已拒绝
      }
    },
    mounted() {
      this.getData();
    },
    methods: {
      getData() {
        this.$refs.Card.start();
        let pagination = this.$refs.Pagination;
        let param = {
          current: pagination.current,
          size: pagination.size,
          number: this.searchNumber,
          state: this.state
        };
        pageCurrentEditExpressOrderApi(param).then(result => {
          let response = result.resultParam.editExpressOrderPage;
          this.formData = response.records;
          pagination.total = response.total;
          this.$refs.Card.stop();
        })
      }
    }
  }
</script>
